﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CategoryEdit.aspx.cs" Inherits="AiLuWeb.WebSite.WebAdmin.CategoryEdit" %>
<%@ Import Namespace="System.Linq" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><%=id > 0 ? "修改分类" : "新建分类" %></title>
    <link href="/css/admin/admin.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="/js/jquery.js"></script>
    <script type="text/javascript" src="/js/admin/admin.js"></script>
</head>
<body>
    <div class="titlebt"><%=id > 0 ? "修改分类" : "新建分类" %></div>
    <!--显示列表-->
    <div id="all">
        <div class="k_all3">
            <form action="" method="post">
            <table width="100%" cellpadding="0" cellspacing="0" id="bk">
                <tbody>
                    <% 
                        if (pid != 15)
                        { 
                    %>
                    <tr>
                        <td width="100" height="35" align="right">
                            <span class="red">*</span>父级分类名称：
                        </td>
                        <td width="990">
                            <input type="hidden" name="pid" value="<%=pid %>" />
                            <% 
                                var parItem = AiLuWeb.WebSite.Code.Utility.GetNewsClass().FirstOrDefault(c => c.Id == pid);
                                if (parItem != null)
                                {
                                    Response.Write(parItem.Name);
                                } 
                            %>
                        </td>
                    </tr>
                    <% 
                        }
                        else
                        { 
                    %>
                    <tr>
                        <td width="100" height="35" align="right">
                            <span class="red">*</span>父级分类名称：
                        </td>
                        <td width="990">
                            <select id="cateid" name="cateid" data-val="true" data-val-required="*请选择父级分类！" >
                                <option value="15">产品中心</option>
                                <% 
                                    foreach (var item in AiLuWeb.WebSite.Code.Utility.GetNewsClass().Where(c => c.PId == 15))
                                    { 
                                %>
                                <option value='<%=item.Id %>' <%if(info.PId==item.Id) {%> selected="selected"<%} if(id==item.Id){%> disabled="disabled"<%} %>>&nbsp;&nbsp;├<%=item.Name%></option>
                                <%
                                    }
                                %>
                            </select>
                            <span class="field-validation-valid" data-valmsg-for="cateid" data-valmsg-replace="true"></span>
                        </td>
                    </tr>
                    <%   
                        }    
                    %>
                    <tr>
                        <td width="100" height="35" align="right">
                            <span class="red">*</span>分类名称：
                        </td>
                        <td width="990">
                            <input type="text" id="mname" name="mname" value="<%=info.Name %>" data-val="true" data-val-required="*请填写分类名称！" />
                            <span class="field-validation-valid" data-valmsg-for="mname" data-valmsg-replace="true"></span>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" height="35">
                            <div class="pl200">
                                <input type="submit" class="butt_tle" style="width: 50px" value="确定" />
                                <input type="button" class="butt_tle" style="width: 80px" value="返回列表" onclick='location.href="Category.aspx?pid=<%=pid %>"'/>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
            </form>
        </div>
    </div>
</body>
</html>